package com.micangcaihang.micang.adapter;

import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.micangcaihang.micang.R;
import com.micangcaihang.micang.entity.FTaskBondsmanInfoEntity;

import java.util.List;

/**
 * <pre>
 *     author : Fandy
 *     e-mail : fandayongfly@gmail.com
 *     time   : 2017/08/01
 *     update : 2017/08/01
 *     desc   : 担保人信息适配器
 *     version: 1.0
 * </pre>
 */

public class FTaskBondsmanAdapter extends BaseQuickAdapter<FTaskBondsmanInfoEntity, BaseViewHolder> {
    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param layoutResId The layout resource id of each item.
     * @param data        A new list is created out of this one to avoid mutable list
     */
    public FTaskBondsmanAdapter(@LayoutRes int layoutResId, @Nullable List<FTaskBondsmanInfoEntity> data) {
        super(layoutResId, data);
    }

    /**
     * Implement this method and use the helper to adapt the view to the given item.
     *
     * @param helper A fully initialized helper.
     * @param item   The item that needs to be displayed.
     */
    @Override
    protected void convert(BaseViewHolder helper, FTaskBondsmanInfoEntity item) {
        if (helper.getLayoutPosition() == 0) {
            helper.setVisible(R.id.tv_add, true);
        } else {
            helper.setVisible(R.id.tv_add, false);
        }
    }
}
